package configruation

import (
	"github.com/shenyisyn/goft-gin/goft"
	"sinery.net.goft/src/controllers"
)

//@routerConfigruation
//@router
type RouterConfig struct {
	Goft            *goft.Goft                   `inject:"-"`
	IndexController *controllers.IndexController `inject:"-"`
	UserController  *controllers.UserController  `inject:"-"`
	TestCtl         *controllers.TestController  `inject:"-"`
}

func NewRouterConfig() *RouterConfig {
	return &RouterConfig{}
}
func (this *RouterConfig) IndexRoutes() interface{} {
	this.Goft.Handle("GET", "/index", this.IndexController.Index)
	return goft.Empty
}
func (this *RouterConfig) UserRoutes() interface{} {
	this.Goft.Handle("GET", "/user", this.UserController.Index)
	this.Goft.Handle("GET", "/user/:uid", this.UserController.Index)
	return goft.Empty
}
func (this *RouterConfig) TestRoutes() interface{} {
	this.Goft.Handle("GET", "/test", this.TestCtl.Index)
	this.Goft.Handle("GET", "/sim", this.TestCtl.SimpleQuey)
	this.Goft.Handle("GET", "/sin", this.TestCtl.SimpleWithArgs)
	return goft.Empty
}
